/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * UserGuide.java
 *
 * Created on Apr 17, 2010, 4:00:24 PM
 */

package edu.asu.cse360.client.ui.frame;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

/**
 *This class is to get the user guide text file and display it whenever someone requests for it
 * @author owner
 */
public class UserGuide extends javax.swing.JFrame {

    /** Creates new form UserGuide */
    public UserGuide() {
        initComponents();
        File pFile;
        pFile = new File("src/main/resources/UserGuide.txt");
        try{
            Scanner scan = new Scanner(pFile);
            String userGuide = " ";
            while(scan.hasNext())
            {
                userGuide = userGuide + scan.nextLine();
                userGuide = userGuide + "\n";
            }
            txtUserGuide.setText(userGuide);
        }
        catch (FileNotFoundException e)
        {
            System.out.println("File Not Found.");
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        txtUserGuide = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        txtUserGuide.setColumns(20);
        txtUserGuide.setEditable(false);
        txtUserGuide.setRows(5);
        jScrollPane1.setViewportView(txtUserGuide);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 588, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new UserGuide().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea txtUserGuide;
    // End of variables declaration//GEN-END:variables

}
